﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TravelGenerator.BusinessObjects.ObjectValidator;
using TravelGenerator.BusinessObjects.ModelObjects;

namespace TravelGenerator.BusinessObjects.SavingManagement
{
    /// <summary>
    /// Knowing parameter for saving entity
    /// </summary>
    public class SaveParameter
    {
        #region Properties

        private IValidateEntity entityToSave;
        /// <summary>
        /// Gets or sets the entity to save.
        /// </summary>
        /// <value>The entity to save.</value>
        public IValidateEntity EntityToSave
        {
            get
            {
                return this.entityToSave;
            }
            set
            {
                this.entityToSave = value;
            }
        }

        private Contact contact;
        /// <summary>
        /// Gets or sets the contact.
        /// </summary>
        /// <value>The contact.</value>
        public Contact Contact
        {
            get
            {
                return this.contact;
            }
            set
            {
                this.contact = value;
            }
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="SaveParameter"/> class.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="contact">The contact.</param>
        private SaveParameter(IValidateEntity entity, Contact contact = null)
        {
            this.EntityToSave = entity;
            this.Contact = contact;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Creates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="contact">The contact.</param>
        /// <returns></returns>
        public static SaveParameter Create(IValidateEntity entity, Contact contact = null)
        {
            return new SaveParameter(entity, contact);
        }

        #endregion
    }
}
